package me.ree.zkproduct.service.impl;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

/**
 * ServiceA与ServiceB都是验证循环依赖的类，这两个类互相依赖
 *
 * 验证的结论记录在ServiceA的注释中
 */
//@Data
@Service
public class ServiceB {

    @Autowired
    private ServiceA serviceA;

    private String name;

    private int age;


//    @Autowired
//    public ServiceB(@Lazy ServiceA serviceA) {
//        this.serviceA = serviceA;
//    }

    public ServiceA getServiceA() {
        return this.serviceA;
    }

//    public void setServiceA(ServiceA serviceA) {
//        this.serviceA = serviceA;
//    }

    public String getName() {
        return this.name;
    }

    public int getAge() {
        return this.age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
